home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 8614 / 8614.xpi / chrome / extension.jar / content / ui / recommendations / RecommendationViewClassesMap.js < prev    next >
Encoding:
Text File  |  2010-02-10  |  1.5 KB  |  85 lines

  1. Glydo.RecommendationViewClassesMap = Prototype.Class.create({
  2.     initialize: function(table) {
  3.         this.table = table;
  4.     },
  5.  
  6.     internalLookup: function(rec) {
  7.         var res = this.table[rec.contentType];
  8.         if (Prototype.O.isFunction(res)) {
  9.             return res.call(rec);
  10.         } else {
  11.             return res;
  12.         }
  13.     },
  14.     
  15.     lookup: function(rec) {
  16.         var res = this.internalLookup(rec);
  17.         if (res) {
  18.             return res.className || "glydo-default";
  19.         }
  20.         return     "glydo-default";
  21.     },
  22.     
  23.     nStyles: function(rec) {
  24.         var res = this.internalLookup(rec);
  25.         if (res) {
  26.             return res.nStyles || 1;
  27.         }
  28.         return 1;
  29.     }
  30. });
  31.  
  32. Glydo.RECOMMENDATION_VIEW_CLASSES_MAP = new Glydo.RecommendationViewClassesMap({
  33.     "info": {
  34.         className: "glydo-info",
  35.         nStyles: 1
  36.     },
  37.     "review": {
  38.         className: "glydo-review",
  39.         nStyles: 1
  40.     },
  41.     "twitter": {
  42.         className: "glydo-twitter",
  43.         nStyles: 3
  44.     },
  45.     "rss": {
  46.         className: "glydo-rss",
  47.         nStyles: 1
  48.     },
  49.     "other": {
  50.         className: "glydo-other",
  51.         nStyles: 1
  52.     },
  53.     "news": {
  54.         className: "glydo-news",
  55.         nStyles: 1
  56.     },
  57.     "video": {
  58.         className: "glydo-video",
  59.         nStyles: 1
  60.     },
  61.     "product": function() {
  62.         if (this.contextRelation == "same_product_alternative_offer") {
  63.             return ({
  64.                 className: "glydo-store-offer",
  65.                 nStyles: 1
  66.             });
  67.         }
  68.         if (this.contextRelation == "ad") {
  69.             return ({
  70.                 className: "glydo-product-ad",
  71.                 nStyles: 1
  72.             });
  73.         }
  74.         return ({
  75.             className: "glydo-product-ad",
  76.             nStyles: 1
  77.         });
  78.     },
  79.     "ad": {
  80.         className: "glydo-ad",
  81.         nStyles: 1
  82.     }
  83. });
  84.  
  85.